<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="assets/css/foundation.min.css" />
	<link href="assets/css/font-awesome.min.css" rel="stylesheet" />
	<link rel="shortcut icon" href="assets/ico/favicon.png">
	<link rel="stylesheet" href="assets/css/page.css" />
	<title>Laravel 速查表</title>
</head>
<body>
	<div class="fixed">
		<nav class="top-bar">
			<ul class="title-area">
				<li class="name"><h1><a href="./">Laravel 速查表</a></h1></li>
				<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
			</ul>
			<section class="top-bar-section">
				<ul class="left">
					<li class="comments-toggle"><a href="#"><i class="icon-comments"></i> 去掉注释</a></li>
                    <li><a href="Laravel%20Cheatsheet.pdf"><i class="icon-download"></i> PDF版</a></li>
					<li><a href="http://github.com/jesseobrien/laravel-cheatsheet"><i class="icon-github"></i> Github</a></li>
					<li><a href="http://three.laravel.com/"><i class="icon-file-text"></i> Laravel 3 文档</a></li>
					<li><a href="http://laravel.com/docs"><i class="icon-file-text"></i> Laravel 4 文档</a></li>
				</ul>
			</section>
		</nav>
	</div>

	<div class="row full-width">
		<div class="large-4 columns code-column">


			<h4><a name="artisan" href="#artisan">Artisan</a></h4>
			<pre class="prettyprint lang-php">
php artisan --help OR -h
php artisan --quiet OR -q
php artisan --version OR -V
php artisan --no-interaction OR -n
php artisan --ansi
php artisan --no-ansi
php artisan --env
// -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose

php artisan changes
php artisan clear-compiled
php artisan down
php artisan dump-autoload
php artisan env
php artisan help
php artisan list
php artisan migrate
php artisan optimize
php artisan routes
php artisan serve
php artisan tinker
php artisan up
php artisan workbench

php artisan asset:publish [--bench[="vendor/package"]] [--path[="..."]] [package]
php artisan auth:reminders
php artisan cache:clear
php artisan command:make name [--command[="..."]] [--path[="..."]] [--namespace[="..."]]
php artisan config:publish
php artisan controller:make [--bench="vendor/package"]
php artisan db:seed [--class[="..."]] [--database[="..."]]
php artisan key:generate
php artisan migrate [--bench="vendor/package"] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]
php artisan migrate:install [--database[="..."]]
php artisan migrate:make name [--bench="vendor/package"] [--create] [--package[="..."]] [--path[="..."]] [--table[="..."]]
php artisan migrate:refresh [--database[="..."]] [--seed]
php artisan migrate:reset [--database[="..."]] [--pretend]
php artisan migrate:rollback [--database[="..."]] [--pretend]
php artisan queue:listen [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--timeout[="..."]] [connection]
php artisan queue:subscribe [--type[="..."]] queue url
php artisan queue:work [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--sleep] [connection]
php artisan session:table
php artisan view:publish [--path[="..."]] package
			</pre>

			<h4><a name="composer" href="#composer">Composer</a> <a href="http://getcomposer.org/doc/03-cli.md" title="Composer CLI Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">
composer create-project laravel/laravel folder_name
composer install
composer update
composer dump-autoload [--optimize]
composer self-update
			</pre>



			<h4><a name="routing" href="#routing">Routing</a> <a href="http://laravel.com/docs/routing" title="Routing @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Route::get('foo', function(){});
Route::get('foo', 'ControllerName@function');
Route::controller('foo', 'FooController');
			</pre>

			<h6>Triggering Errors</h6>
			<pre class="prettyprint lang-php">App::abort(404);
App::missing(function($exception){});
throw new NotFoundHttpException;
			</pre>

			<h6>Route Parameters</h6>
			<pre class="prettyprint lang-php">Route::get('foo/{bar}', function($bar){});
Route::get('foo/{bar?}', function($bar = 'bar'){});
			</pre>

			<h6>HTTP Verbs</h6>
			<pre class="prettyprint lang-php">Route::any('foo', function(){});
Route::post('foo', function(){});
Route::put('foo', function(){});
Route::patch('foo', function(){});
Route::delete('foo', function(){});
// RESTful actions
Route::resource('foo', 'FooController');
			</pre>

			<h6>Secure Routes</h6>
			<pre class="prettyprint lang-php">Route::get('foo', array('https', function(){}));</pre>

			<h6>Route Constraints</h6>
			<pre class="prettyprint lang-php">Route::get('foo/{bar}', function($bar){})
	->where('bar', '[0-9]+');
Route::get('foo/{bar}/{baz}', function($bar, $baz){})
	->where(array('bar' => '[0-9]+', 'baz' => '[A-Za-z]'))
			</pre>

			<h6>Filters</h6>
			<pre class="prettyprint lang-php">// Declare an auth filter
Route::filter('auth', function(){});
// Register a class as a filter
Route::filter('foo', 'FooFilter');
Route::get('foo', array('before' => 'auth', function(){}));
// Routes in this group are guarded by the 'auth' filter
Route::get('foo', array('before' => 'auth', function(){}));
Route::group(array('before' => 'auth'), function(){});
// Pattern filter
Route::when('foo/*', 'foo');
// HTTP verb pattern
Route::when('foo/*', 'foo', array('post'));
			</pre>

			<h6>Named Routes</h6>
			<pre class="prettyprint lang-php">Route::currentRouteName();
Route::get('foo/bar', array('as' => 'foobar', function(){}));
			</pre>

			<h6>Route Prefixing</h6>
			<pre class="prettyprint lang-php">// This route group will carry the prefix 'foo'
Route::group(array('prefix' => 'foo'), function(){})
			</pre>

			<h6>Sub-Domain Routing</h6>
			<pre class="prettyprint lang-php">// {sub} will be passed to the closure
Route::group(array('domain' => '{sub}.example.com'), function(){});
			</pre>

		<h4><a name="urls" href="#urls">URLs</a></h4>
			<pre class="prettyprint lang-php">URL::full();
URL::current();
URL::previous();
URL::to('foo/bar', $parameters, $secure);
URL::action('FooController@method', $parameters, $absolute);
URL::route('foo', $parameters, $absolute);
URL::secure('foo/bar', $parameters);
URL::asset('css/foo.css', $secure);
URL::secureAsset('css/foo.css');
URL::isValidUrl('http://example.com');
URL::getRequest();
URL::setRequest($request);
URL::getGenerator();
URL::setGenerator($generator);
			</pre>


			<h4><a name="events" href="#events">Events</a> <a href="http://laravel.com/docs/events" title="Events @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Event::fire('foo.bar', array($bar));
Event::listen('foo.bar', function($bar){});
Event::listen('foo.*', function($bar){});
Event::listen('foo.bar', 'FooHandler', 10);
Event::listen('foo.bar', 'BarHandler', 5);
Event::listen('foor.bar', function($event){ return false; });
Event::queue('foo', array($bar));
Event::flusher('foo', function($bar){});
Event::flush('foo');
Event::forget('foo');
Event::subscribe(new FooEventHandler);
			</pre>

			<h4><a name="db" href="#db">Database</a> <a href="http://laravel.com/docs/queries" title="Query Builder @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">
DB::connection('connection_name');
DB::statement('drop table users');
DB::listen(function($sql, $bindings, $time){ code_here; });
DB::transaction(function(){ transaction_code_here; });
// Cache a query for $time minutes
DB::table('users')->remember($time)->get();
// Escape raw input
DB::raw('sql expression here');
			</pre>

			<h6>Selects</h6>
			<pre class="prettyprint lang-php">DB::table('name')->get();
DB::table('name')->distinct()->get();
DB::table('name')->select('column as column_alias')->get();
DB::table('name')->where('name', '=', 'John')->get();
DB::table('name')->whereBetween('column', array(1, 100))->get();
DB::table('name')->whereIn('column', array(1, 2, 3))->get();
DB::table('name')->whereNotIn('column', array(1, 2, 3))->get();
DB::table('name')->whereNull('column')->get();
DB::table('name')->whereNotNull('column')->get();
DB::table('name')->groupBy('column')->get();
DB::table('name')->orderBy('column')->get();
DB::table('name')->having('count', '>', 100)->get();
DB::table('name')->skip(10)->take(5)->get();
DB::table('name')->first();
DB::table('name')->pluck('column');
DB::table('name')->lists('column');
// Joins
DB::table('name')->join('table', 'name.id', '=', 'table.id')
    ->select('name.id', 'table.email');
			</pre>

			<h6>Inserts, Updates, Deletes</h6>
			<pre class="prettyprint lang-php">DB::table('name')->insert(array('name' => 'John', 'email' => 'john@example.com'));
DB::table('name')->insertGetId(array('name' => 'John', 'email' => 'john@example.com'));
// Batch insert
DB::table('name')->insert(
	array('name' => 'John', 'email' => 'john@example.com')
	array('name' => 'James', 'email' => 'james@example.com')
);
// Update an entry
DB::table('name')->where('name', '=', 'John')
	->update(array('email' => 'john@example2.com'));
// Delete everything from a table
DB::table('name')->delete();
// Delete specific records
DB::table('name')->where('id', '>', '10')->delete();
DB::table('name')->truncate();
			</pre>

			<h6>Aggregates</h6>
			<pre class="prettyprint lang-php">DB::table('name')->count();
DB::table('name')->max('column');
DB::table('name')->min('column');
DB::table('name')->avg('column');
DB::table('name')->sum('column');
DB::table('name')->increment('column');
DB::table('name')->increment('column', $amount);
DB::table('name')->decrement('column');
DB::table('name')->decrement('column', $amount);
			</pre>

			<h6>Raw Expressions</h6>
			<pre class="prettyprint lang-php">DB::select('select * from users where id = ?', array('value'));
DB::table('name')->select(DB::raw('count(*) as count, column2'))->get();
			</pre>

			<h4><a name="eloquent" href="#eloquent">Eloquent</a> <a href="http://laravel.com/docs/eloquent" title="Eloquent @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Model::create(array('key' => 'value'));
// Fill a model with an array of attributes, beware of mass assignment!
Model::fill($attributes);
Model::destroy(1);
Model::all();
Model::find(1);
// Find using dual primary key
Model::find(array('first', 'last'));
// Throw an exception if the lookup fails
Model::findOrFail(1);
// Find using dual primary key and throw exception if the lookup fails
Model::findOrFail(array('first', 'last'));
Model::where('foo', '=', 'bar')->get();
Model::where('foo', '=', 'bar')->first();
// Throw an exception if the lookup fails
Model::where('foo', '=', 'bar')->firstOrFail();
Model::where('foo', '=', 'bar')->count();
Model::where('foo', '=', 'bar')->delete();
Model::whereRaw('foo = bar and cars = 2', array(20))->get();
Model::remember(5)->get();
Model::remember(5, 'cache-key-name')->get();
Model::on('connection-name')->find(1);
Model::with('relation')->get();
Model::all()->take(10);
Model::all()->skip(10);
			</pre>

			<h6>Soft Delete</h6>
			<pre class="prettyprint lang-php">Model::withTrashed()->where('cars', 2)->get();
Model::withTrashed()->where('cars', 2)->restore();
Model::where('cars', 2)->forceDelete();
Model::onlyTrashed()->where('cars', 2)->get();
			</pre>

			<h6>Events</h6>
			<pre class="prettyprint lang-php">Model::creating(function($model){});
Model::created(function($model){});
Model::updating(function($model){});
Model::updated(function($model){});
Model::saving(function($model){});
Model::saved(function($model){});
Model::deleting(function($model){});
Model::deleted(function($model){});
Model::observe(new FooObserver);
			</pre>
			<h6>Eloquent Configuration</h6>
			<pre class="prettyprint lang-php">Eloquent::unguard();
// Disables mass assignment exceptions from being thrown from model inserts and updates
Eloquent::reguard();
// Renables any ability to throw mass assignment exceptions
			</pre>
			
			<h4>
				<a name="remote" href="#remote">The Remote Component</a>
			</h4>
			<h6>Executing Commands</h6>
			<pre class="prettyprint lang-php">SSH::run(array $commands);
SSH::into($remote)->run(array $commands); // specify remote, otherwise assumes default
SSH::run(array $commands, function($line)
{
	echo $line.PHP_EOL;
});
			</pre>
			
			<h6>Tasks</h6>
			<pre class="prettyprint lang-php">SSH::define($taskName, array $commands); // define
SSH::task($taskName, function($line) // execute
{
	echo $line.PHP_EOL;
});
			</pre>
			
			<h6>SFTP Uploads</h6>
			<pre class="prettyprint lang-php">SSH::put($localFile, $remotePath);
SSH::putString($string, $remotePath);
			</pre>
		</div>
			
		<div class="large-4 columns code-column">
			<h4><a name="db" href="#db">Schema</a> <a href="http://laravel.com/docs/schema" title="Schema Builder @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">
Schema::create('table', function($table)
{
    $table->increments('id');
});
// Specify a Connection
Schema::connection('foo')->create('table', function($table){});
Schema::rename($from, $to);
Schema::drop('table');
Schema::dropIfExists('table');
Schema::hasTable('table');
Schema::hasColumn('table', 'column');
// Update an existing table
Schema::table('table', function($table){});
$table->renameColumn('from', 'to');
$table->dropColumn(string|array);
$table->engine = 'InnoDB';
// Only work on MySQL
$table->string('name')->after('email');
			</pre>

			<h6>Indexes</h6>
			<pre class="prettyprint lang-php">
$table->string('column')->unique();
$table->primary('column');
// Creates a dual primary key
$table->primary(array('first', 'last'));
$table->unique('column');
$table->unique('column', 'key_name');
// Creates a dual unique index
$table->unique(array('first', 'last'));
$table->unique(array('first', 'last'), 'key_name');
$table->index('column');
$table->index('column', 'key_name');
// Creates a dual index
$table->index(array('first', 'last'));
$table->index(array('first', 'last'), 'key_name');
$table->dropPrimary('table_column_primary');
$table->dropUnique('table_column_unique');
$table->dropIndex('table_column_index');
			</pre>

			<h6>Foreign Keys</h6>
			<pre class="prettyprint lang-php">
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->dropForeign('posts_user_id_foreign');
			</pre>

			<h6>Column Types</h6>
			<pre class="prettyprint lang-php">$table->increments('id');
$table->bigIncrements('id');
$table->string('email');
$table->string('name', 100);
$table->integer('votes');
$table->bigInteger('votes');
$table->smallInteger('votes');
$table->float('amount');
$table->double('column', 15, 8);
$table->decimal('amount', 5, 2);
$table->boolean('confirmed');
$table->date('created_at');
$table->dateTime('created_at');
$table->time('sunrise');
$table->timestamp('added_on');
$table->timestamps();
$table->softDeletes();
$table->text('description');
$table->binary('data');
$table->enum('choices', array('foo', 'bar'));
$table->morphs('parent');
// Adds INTEGER parent_id and STRING parent_type
->nullable()
->default($value)
->unsigned()
			</pre>

			<h4><a name="input" href="#input">Input</a> <a href="http://laravel.com/docs/requests" title="Input @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Input::get('key');
// Default if the key is missing
Input::get('key', 'default');
Input::has('key');
Input::all();
// Only retrieve 'foo' and 'bar' when getting input
Input::only('foo', 'bar');
// Disregard 'foo' when getting input
Input::except('foo');
			</pre>

			<h6>Session Input (flash)</h6>
			<pre class="prettyprint lang-php">// Flash input to the session
Input::flash();
Input::flashOnly('foo', 'bar');
Input::flashExcept('foo', 'baz');
Input::old('key','default_value');
			</pre>

			<h6>Files</h6>
			<pre class="prettyprint lang-php">// Use a file that's been uploaded
Input::file('filename');
// Determine if a file was uploaded
Input::hasFile('filename');
// Access file properties
Input::file('name')->getRealPath();
Input::file('name')->getClientOriginalName();
Input::file('name')->getClientOriginalExtension();
Input::file('name')->getSize();
Input::file('name')->getMimeType();
// Move an uploaded file
Input::file('name')->move($destinationPath);
// Move an uploaded file
Input::file('name')->move($destinationPath, $fileName);
			</pre>

			<h4><a name="cache" href="#cache">Cache</a></h4>
			<pre class="prettyprint lang-php">Cache::put('key', 'value', $minutes);
Cache::add('key', 'value', $minutes);
Cache::forever('key', 'value');
Cache::remember('key', $minutes, function(){ return 'value' });
Cache::rememberForever('key', function(){ return 'value' });
Cache::forget('key');
Cache::has('key');
Cache::get('key');
Cache::get('key', 'default');
Cache::get('key', function(){ return 'default'; });
Cache::increment('key');
Cache::increment('key', $amount);
Cache::decrement('key');
Cache::decrement('key', $amount);
Cache::section('group')->put('key', $value);
Cache::section('group')->get('key');
Cache::section('group')->flush();
			</pre>

			<h4><a name="cookies" href="#cookies">Cookies</a></h4>
			<pre class="prettyprint lang-php">Cookie::get('key');
// Create a cookie that lasts for ever
Cookie::forever('key', 'value');
// Set a cookie before a response has been created
Cookie::queue('key', 'value', 'minutes');
// Send a cookie with a response
$response = Response::make('Hello World');
$response->withCookie(Cookie::make('name', 'value', $minutes));
			</pre>

			<h4><a name="sessions" href="#sessions">Sessions</a></h4>
			<pre class="prettyprint lang-php">Session::get('key');
Session::get('key', 'default');
Session::get('key', function(){ return 'default'; });
Session::put('key', 'value');
Session::all();
Session::has('key');
Session::forget('key');
Session::flush();
Session::regenerate();
Session::flash('key', 'value');
Session::reflash();
Session::keep(array('key1', 'key2'));
			</pre>

			<h4><a name="requests" href="#requests">Requests</a></h4>
			<pre class="prettyprint lang-php">Request::path();
Request::is('foo/*');
Request::url();
Request::segment(1);
Request::header('Content-Type');
Request::server('PATH_INFO');
Request::ajax();
Request::secure();
			</pre>

			<h4><a name="responses" href="#responses">Responses</a></h4>
			<pre class="prettyprint lang-php">return Response::make($contents);
return Response::make($contents, 200);
return Response::json(array('key' => 'value'));
return Response::json(array('key' => 'value'))
	->setCallback(Input::get('callback'));
return Response::download($filepath);
return Response::download($filepath, $filename, $headers);
// Create a response and modify a header value
$response = Response::make($contents, 200);
$response->header('Content-Type', 'application/json');
return $response;
// Attach a cookie to a response
return Response::make($content)
	->withCookie(Cookie::make('key', 'value'));
			</pre>

			<h4><a name="redirects" href="#redirects">Redirects</a></h4>
			<pre class="prettyprint lang-php">return Redirect::to('foo/bar');
return Redirect::to('foo/bar')->with('key', 'value');
return Redirect::to('foo/bar')->withInput(Input::get());
return Redirect::to('foo/bar')->withInput(Input::except('password'));
return Redirect::to('foo/bar')->withErrors($validator);
return Redirect::back();
return Redirect::route('foobar');
return Redirect::route('foobar', array('value'));
return Redirect::route('foobar', array('key' => 'value'));
return Redirect::action('FooController@index');
return Redirect::action('FooController@baz', array('value'));
return Redirect::action('FooController@baz', array('key' => 'value'));
// If intended redirect is not defined, defaults to foo/bar.
return Redirect::intended('foo/bar');
			</pre>

			<h4><a name="ioc" href="#ioc">IoC</a></h4>
			<pre class="prettyprint lang-php">App::bind('foo', function($app){ return new Foo; });
App::make('foo');
// If this class exists, it's returned
App::make('FooBar');
App::singleton('foo', function(){ return new Foo; });
App::instance('foo', new Foo);
App::bind('FooRepositoryInterface', 'BarRepository');
App::register('FooServiceProvider');
// Listen for object resolution
App::resolving(function($object){});
			</pre>

			<h4><a name="security" href="#security">Security</a></h4>
			<h6>Passwords</h6>
			<pre class="prettyprint lang-php">Hash::make('secretpassword');
Hash::check('secretpassword', $hashedPassword);
Hash::needsRehash($hashedPassword);
			</pre>
			<h6>Auth</h6>
			<pre class="prettyprint lang-php">// Check if the user is logged in
Auth::check();
Auth::user();
Auth::attempt(array('email' => $email, 'password' => $password));
// 'Remember me' by passing true to Auth::attempt()
Auth::attempt($credentials, true);
// Log in for a single request
Auth::once($credentials);
Auth::login(User::find(1));
Auth::loginUsingId(1);
Auth::logout();
Auth::validate($credentials);
Auth::basic('username');
Auth::onceBasic();
Password::remind($credentials, function($message, $user){});
			</pre>

			<h6>Encryption</h6>
			<pre class="prettyprint lang-php">Crypt::encrypt('secretstring');
Crypt::decrypt($encryptedString);
Crypt::setMode('ctr');
Crypt::setCipher($cipher);
			</pre>

			<h4><a name="mail" href="#mail">Mail</a> <a href="http://laravel.com/docs/mail" title="Mail @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Mail::send('email.view', $data, function($message){});
Mail::send(array('html.view', 'text.view'), $data, $callback);
Mail::queue('email.view', $data, function($message){});
Mail::queueOn('queue-name', 'email.view', $data, $callback);
Mail::later(5, 'email.view', $data, function($message){});
// Write all email to logs instead of sending
Mail::pretend();
			</pre>

            <h6>Messages</h6>
            <pre class="prettyprint lang-php">// These can be used on the $message instance passed into Mail::send() or Mail::queue()
$message->from('email@example.com', 'Mr. Example');
$message->sender('email@example.com', 'Mr. Example');
$message->returnPath('email@example.com');
$message->to('email@example.com', 'Mr. Example');
$message->cc('email@example.com', 'Mr. Example');
$message->bcc('email@example.com', 'Mr. Example');
$message->replyTo('email@example.com', 'Mr. Example');
$message->subject('Welcome to the Jungle');
$message->priority(2);
$message->attach('foo\bar.txt', $options);
// This uses in-memory data as attachments
$message->attachData('bar', 'Data Name', $options);
// Embed a file in the message and get the CID
$message->embed('foo\bar.txt');
$message->embedData('foo', 'Data Name', $options);
// Get the underlying Swift Message instance
$message->getSwiftMessage();
            </pre>

			<h4><a name="queues" href="#queues">Queues</a> <a href="http://laravel.com/docs/queues" title="Queues @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">Queue::push('SendMail', array('message' => $message));
Queue::push('SendEmail@send', array('message' => $message));
Queue::push(function($job) use $id {});
php artisan queue:listen
php artisan queue:listen connection
php artisan queue:listen --timeout=60
php artisan queue:work
			</pre>

			<h4><a name="validation" href="#validation">Validation</a></h4>
			<pre class="prettyprint lang-php">Validator::make(
	array('key' => 'Foo'),
	array('key' => 'required|in:Foo')
);
Validator::extend('foo', function($attribute, $value, $params){});
Validator::extend('foo', 'FooValidator@validate');
Validator::resolver(function($translator, $data, $rules, $msgs)
{
	return new FooValidator($translator, $data, $rules, $msgs);
});
			</pre>

			<h6>Rules</h6>
			<pre class="prettyprint lang-php">accepted
active_url
after:YYYY-MM-DD
before:YYYY-MM-DD
alpha
alpha_dash
alpha_num
between:1,10
confirmed
date
date_format:YYYY-MM-DD
different:fieldname
email
exists:table,column
image
in:foo,bar,baz
not_in:foo,bar,baz
integer
numeric
ip
max:value
min:value
mimes:jpeg,png
regex:[0-9]
required
required_if:field,value
required_with:foo,bar,baz
required_without:foo,bar,baz
same:field
size:value
unique:table,column,except,idColumn
url

			</pre>

		</div>
		<div class="large-4 columnsi code-column">
			<h4><a name="views" href="#views">Views</a></h4>
			<pre class="prettyprint lang-php">View::make('path/to/view');
View::make('foo/bar')->with('key', 'value');
View::make('foo/bar')->withKey('value');
View::make('foo/bar', array('key' => 'value'));
View::exists('foo/bar');
// Share a value across all views
View::share('key', 'value');
// Nesting views
View::make('foo/bar')->nest('name', 'foo/baz', $data);
// Register a view composer
View::composer('viewname', function($view){});
//Register multiple views to a composer
View::composer(array('view1', 'view2'), function($view){});
// Register a composer class
View::composer('viewname', 'FooComposer');
View::creator('viewname', function($view){});
			</pre>

			<h4><a name="blade" href="#blade">Blade Templates</a></h4>
			<pre class="prettyprint lang-php">@extends('layout.name')
// Begin a section
@section('name')
// End a section
@stop
// End a section and yield
@show
// Show a section in a template
@yield('name')
@include('view.name')
@include('view.name', array('key' => 'value'));
@lang('messages.name')
@choice('messages.name', 1);
@if
@else
@elseif
@endif
@unless
@endunless
@for
@endfor
@foreach
@endforeach
@while
@endwhile
// Echo content
{{ $var }}
// Echo escaped content
{{{ $var }}}
{{-- Blade Comment --}}
			</pre>

			<h4><a name="forms" href="#forms">Forms</a></h4>
			<pre class="prettyprint lang-php">Form::open(array('url' => 'foo/bar', 'method' => 'PUT'));
Form::open(array('route' => 'foo.bar'));
Form::open(array('route' => array('foo.bar', $parameter)));
Form::open(array('action' => 'FooController@method'));
Form::open(array('action' => array('FooController@method', $parameter)));
Form::open(array('url' => 'foo/bar', 'files' => true));
Form::close();
Form::token();
Form::model($foo, array('route' => array('foo.bar', $foo->bar)));

			</pre>

			<h6>Form Elements</h6>
			<pre class="prettyprint lang-php">Form::label('id', 'Description');
Form::label('id', 'Description', array('class' => 'foo'));
Form::text('name');
Form::text('name', $value);
Form::text('name', $value, array('class' => 'name'));
Form::textarea('name');
Form::textarea('name', $value);
Form::textarea('name', $value, array('class' => 'name'));
Form::hidden('foo', $value);
Form::password('password');
Form::password('password', array('placeholder' => 'Password'));
Form::email('name', $value, array());
Form::file('name', array('class' => 'name'));
Form::checkbox('name', 'value');
// Generating a checkbox that is checked
Form::checkbox('name', 'value', true, array('class' => 'name'));
Form::radio('name', 'value');	
// Generating a radio input that is selected
Form::radio('name', 'value', true, array('class' => 'name'));
Form::select('name', array('key' => 'value'));
Form::select('name', array('key' => 'value'), 'key', array('class' => 'name'));
Form::submit('Submit!');
Form::macro('fooField', function()
{
	return '&lt;input type="custom"/&gt;';
});
Form::fooField();
			</pre>

			<h4><a name="html" href="#html">HTML Builder</a></h4>
			<pre class="prettyprint lang-php">HTML::macro('name', function(){});
HTML::entities($value);
HTML::decode($value);
HTML::script($url, $attributes);
HTML::style($url, $attributes);
HTML::image($url, $alt, $attributes);
HTML::link($url, 'title', $attributes, $secure);
HTML::secureLink($url, 'title', $attributes);
HTML::linkAsset($url, 'title', $attributes, $secure);
HTML::linkSecureAsset($url, 'title', $attributes);
HTML::linkRoute($name, 'title', $parameters, $attributes);
HTML::linkAction($action, 'title', $parameters, $attributes);
HTML::mailto($email, 'title', $attributes);
HTML::email($email);
HTML::ol($list, $attributes);
HTML::ul($list, $attributes);
HTML::listing($type, $list, $attributes);
HTML::listingElement($key, $type, $value);
HTML::nestedListing($key, $type, $value);
HTML::attributes($attributes);
HTML::attributeElement($key, $value);
HTML::obfuscate($value);
			</pre>

			<h4><a name="str" href="#str">Strings</a></h4>
			<pre class="prettyprint lang-php">// Transliterate a UTF-8 value to ASCII
Str::ascii($value)
Str::camel($value)
Str::contains($haystack, $needle)
Str::endsWith($haystack, $needles)
// Cap a string with a single instance of a given value.
Str::finish($value, $cap)
Str::is($pattern, $value)
Str::length($value)
Str::limit($value, $limit = 100, $end = '...')
Str::lower($value)
Str::words($value, $words = 100, $end = '...')
Str::plural($value, $count = 2)
// Generate a more truly "random" alpha-numeric string.
Str::random($length = 16)
// Generate a "random" alpha-numeric string.
Str::quickRandom($length = 16)
Str::upper($value)
Str::title($value)
Str::singular($value)
Str::slug($title, $separator = '-')
Str::snake($value, $delimiter = '_')
Str::startsWith($haystack, $needles)
// Convert a value to studly caps case.
Str::studly($value)
Str::macro($name, $macro)
			</pre>

			<h4><a name="localization" href="#localization">Localization</a> <a href="http://laravel.com/docs/localization" title="Localization @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">App::setLocale('en');
Lang::get('messages.welcome');
Lang::get('messages.welcome', array('foo' => 'Bar'));
Lang::has('messages.welcome');
Lang::choice('messages.apples', 10);
			</pre>

			<h4><a name="files" href="#files">Files</a> <a href="http://laravel.com/api/class-Illuminate.Filesystem.Filesystem.html" title="Filesystem @ Laravel Docs"><i class="icon-file-text"></i></a></h4>
			<pre class="prettyprint lang-php">File::exists('path');
File::get('path');
File::getRemote('path');
File::getRequire('path');
File::requireOnce('path');
File::put('path', 'contents');
File::append('path', 'data');
File::delete('path');
File::move('path', 'target');
File::copy('path', 'target');
File::extension('path');
File::type('path');
File::size('path');
File::lastModified('path');
File::isDirectory('directory');
File::isWritable('path');
File::isFile('file');
// Find path names matching a given pattern.
File::glob($patterns, $flag);
// Get an array of all files in a directory.
File::files('directory');
// Get all of the files from the given directory (recursive).
File::allFiles('directory');
// Get all of the directories within a given directory.
File::directories('directory');
File::makeDirectory('path',  $mode = 0777, $recursive = false);
File::copyDirectory('directory', 'destination', $options = null);
File::deleteDirectory('directory', $preserve = false);
File::cleanDirectory('directory');
			</pre>


			<h4><a name="helpers" href="#helpers">Helpers</a></h4>
			<h6>Arrays</h6>
			<pre class="prettyprint lang-php">array_add($array, 'key', 'value');
array_build($array, function(){});
array_divide($array);
array_dot($array);
array_except($array, array('key'));
array_fetch($array, 'key');
array_first($array, function($key, $value){}, $default);
// Strips keys from the array
array_flatten($array);
array_forget($array, 'foo');
// Dot notation
array_forget($array, 'foo.bar');
array_get($array, 'foo', 'default');
array_get($array, 'foo.bar', 'default');
array_only($array, array('key'));
// Return array of key => values
array_pluck($array, 'key');
// Return and remove 'key' from array
array_pull($array, 'key');
array_set($array, 'key', 'value');
// Dot notation
array_set($array, 'key.subkey', 'value');
array_sort($array, function(){});
// First element of an array
head($array);
// Last element of an array
last($array);
			</pre>
			<h6>Paths</h6>
			<pre class="prettyprint lang-php">app_path();
public_path();
// App root path
base_path();
storage_path();
			</pre>
			<h6>Strings</h6>
			<pre class="prettyprint lang-php">
camel_case($value);
class_basename($class);
// Escape a string
e('&lt;html&gt;');
starts_with('Foo bar.', 'Foo');
ends_with('Foo bar.', 'bar.');
snake_case('fooBar');
str_contains('Hello foo bar.', 'foo');
// Result: foo/bar/
str_finish('foo/bar', '/');
str_is('foo*', 'foobar');
str_plural('car');
str_random(25);
str_singular('cars');
// Result: FooBar
studly_case('foo_bar');
trans('foo.bar');
trans_choice('foo.bar', $count);
			</pre>
			<h6>URLs and Links</h6>
			<pre class="prettyprint lang-php">action('FooController@method', $parameters);
link_to('foo/bar', $title, $attributes, $secure);
link_to_asset('img/foo.jpg', $title, $attributes, $secure);
link_to_route('route.name', $title, $parameters, $attributes);
link_to_action('FooController@method', $title, $params, $attrs);
// HTML Link
asset('img/photo.jpg', $title, $attributes);
// HTTPS link
secure_asset('img/photo.jpg', $title, $attributes);
secure_url('path', $parameters);
route($route, $parameters, $absolute = true);
url('path', $parameters = array(), $secure = null);
		</pre>
		<h6>Miscellaneous</h6>
		<pre class="prettyprint lang-php">
csrf_token();
dd($value);
value(function(){ return 'bar'; });
with(new Foo)->chainedMethod();
			</pre>

		</div>
	</div>
	<script src="assets/js/jquery-1.10.2.min.js"></script>
	<script src="assets/js/google-code-prettify/prettify.js"></script>
	<script type="text/javascript" src="assets/js/app.js"></script>
</body>
</html>
